CALLS

Section: User Commands (1)
Updated: UNSUP
Index Return to Main Contents
 

NAME

calls - print out calling pattern of a C program  

SYNOPSIS

calls [-aeitv] [-w n] [-f function] [-F function[/file.c]] [-D name[=def]] [-U name] [-I dir] [filenames]  

DESCRIPTION

Calls is intended to help analyze the flow of a program by laying out the functions called in a hierarchical manner. Calls invokes the C preprocessor on the named C source files, and outputs the analyzed calling pattern to standard output. All filenames given will have their calling sequences combined into one hierarchy. If a filename of - is seen, standard input will be read. Functions called but not defined within the source file are shown as:
function
While functions defined in the source files are listed with the file they are declared in in brackets, as shown:
function [main.c] , or
function [static in main.c]
or if the function is not being described
function [see also %d] , or
function [see below]
Recursive references are shown as:
function <<< recursive >>>
For example, given the file prog.c
main() {
        abc();
        def();
}
abc() {
        ghi();
        jkl();
}
static mno() { }
ghi() {
        abc();
        def();
        mno();
}

Executing "calls prog.c" will produce:

    1   main [prog.c]
    2           abc [prog.c]
    3                   ghi [prog.c]
    4                           abc <<< recursive >>>
    5                           def
    6                           mno [static in prog.c]
    7                   jkl
    8           def
 

FLAGS

-a
Normally only the first call to a function is recorded for any given function, under this option all calls are recorded. This may make the output for some large programs very verbose and these are normally not needed to show the calling structure of a program.
-e
Normally an index listing (-i below) does not contain the external functions called in the program, under this option these are also listed. Note this option also turns on the indexing option, -i.
-ffunction
The named function will be printed as the root of a calling tree.
-Ffunction[/file]
The named static function (in the given file) is used as the base of a calling tree, as above. This allows closer examination of sources such as that of dbx(1) that have many functions with the same name.
-h
Display a brief help message.
-i
This option produces an index of all the functions declared in the processed files. Optionally all functions mentioned can be output; see -e above.
-t
This option instructs calls not to display calling trees that were not explicitly asked for on the command line. Using this option as well as the index option one can produce just a list of the functions declared in a file.
-v
Be less verbose in the index output, do not output any defined functions that were not present in any of the output trees. Note this also turns on the index option. For a list of all functions called by 'missle' one might examine the index output of "calls -vt -f missle *.c".
-wn
Set the max indentation width to n. The default is 96 columns.
-Dname
-Dname=def
Define the name for the preprocessor, as if by #define. If no definition is given, the name is defined as 1.
-Uname
Remove any initial definition of name in the preprocessor.
-Idir
Change the path for searching for #include files whose names do not begin with / to look in dir before looking in the directories on the standard list.
 

BUGS

Static functions must be declared (in full) before used to work properly.
Output width checking is only done on the first character on a new line.  

AUTHOR

Originally from the net. Major revisions by Kevin Braunsdorf, PUCC.  

SEE ALSO

cpp(1), cc(1), ctags(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
FLAGS
BUGS
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 02:48:28 GMT, June 08, 2025